var Clean = require('clean-webpack-plugin');
var path = require('path');

module.exports = {
  entry: [
    "./app/index.js"
  ],
  output: {
    path: './www/hotdocs/build',
    publicPath: 'build/',
    filename: "bundle.js"
  },
  devServer: {
    contentBase: './www/hotdocs'
  },
  plugins: [
    new Clean('./www/hotdocs/build'),
  ],
  module: {
    loaders: [{
      test: /\.jsx?$/,
      loaders: ['babel'],
      exclude: /node_modules/
    }, {
      test: /\.less$/,
      loader: "style!css!less"
    }, {
      test: /\.css$/,
      loader: "style!css"
    }, {
      test: /\.scss$/,
      loader: 'style!css!sass'
    }, {
      test: /\.html$/,
      loader: 'text'
    }, {
      test: /\.woff(\?(v=)?[\w\.\-]+)?$/,
      loader: 'url?limit=10000&minetype=application/font-woff'
    }, {
      test: /\.woff2(\?(v=)?[\w\.\-]+)?$/,
      loader: 'url?limit=10000&minetype=application/font-woff'
    }, {
      test: /\.ttf(\?(v=)?[\w\.\-]+)?$/,
      loader: 'url?limit=10000&minetype=application/octet-stream'
    }, {
      test: /\.eot(\?(v=)?[\w\.\-]+)?$/,
      loader: 'file'
    }, {
      test: /\.svg(\?(v=)?[\w\.\-]+)?$/,
      loader: 'url?limit=10000&minetype=image/svg+xml'
    }, {
      test: /\.json$/,
      loader: 'json'
    }, {
      test: /\.(png|jpg|jpeg|gif)(\?(v=)?[\w\.\-]+)?$/i,
      loader: 'url?limit=10000'
    }, {
      test: require.resolve('jquery'),
      loader: 'expose?jQuery'
    }, {
      test: require.resolve('jquery'),
      loader: 'expose?$'
    }]
  },
  resolve: {
  	alias: {
      'app': path.resolve('./app')
  	}
  }
};
